<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
          <script type="text/javascript" src="scripts/jquery-2.0.3.min.js"></script>
     </head>   
<body>
用户姓名：<input type="text" id="username" />
用户密码：<input type="text" id="password" />
用户性别：<input type="text" id="sex" />
<input type="button" value="推送用户信息" id="pushUser" /> 
<br/>
<span id="msg" style="color:red"></span>
<script type="text/javascript">
$("#pushUser").click(function(){
	var data = {
			username : $("#username").val(),
			password : $("#password").val(),
			sex 	 : $("#sex").val()
	};
	ajaxDo("push/user",data);
});
	
function ajaxDo(url,data){
	 $.ajax({
	        url:url ,
	        type: "post",
	        dataType: "json",
	        data: data,
	        success:function(result){
	        	console.log(result);
	           if(result.actionFlag){
	        	   var obj = JSON.stringify(result.data);
	        	   $("#msg").append(obj+"<br/>");
	        	  // alert(obj);
	           }else{
	        	   alert(result.msg);
	           }
	        }
	  });
}	
</script>

</body>
</html>